local LayerBase = class("LayerBase", function()
	return display.newLayer()
end)

function LayerBase:ctor(data,bHaveBg)

    self.vCustomListeners = { }     --监听事件表

    self:CreateForgroundMask(bHaveBg)
    self:enableNodeEvents()
end

function LayerBase:close()
	self:runAction(cca.seq({cca.delay(0.1),cca.removeSelf()}))
end

function LayerBase:CreateForgroundMask(bHaveBg)
    self.maskLayer = require("app.layer.MaskLayer").new(bHaveBg)
    self.maskLayer:addTo(self, -10)
end

function LayerBase:initUI()
     self.p_bg = display.newSprite("UI/bg/layer_bg.jpg")
    td.AddRelaPos(self,self.p_bg)
end

function LayerBase:AddDispatchEvent(name, func)       --添加消息监听，消息名称，触发回调
	local customListener = require("app.event.EventDispatcher"):GetInstance():AddEventListener(name, func)
    table.insert(self.vCustomListeners, customListener)
    --td.dispatchEvent(_eName, _data)   --发送消息方法
end


return LayerBase